<?php
	//Proxy to get mahasamadhi_registration value object from database
	class Mahasamadhi_registration_proxy extends Model
	{
		public function __construct()
		{
			parent::__construct();
		}
		
		public function getMahasamadhiRegistrationObject( $ms_reg_history_id )
		{
			$this->load->model('proxies/mahasamadhi/Mahasamadhi_proxy');
			$this->load->model('values/mahasamadhi/Mahasamadhi_registration_value');

			$ms_registration_value = new Mahasamadhi_registration_value();

			//Get registration info
			$getRegistrant = $this->db->query('
												SELECT    	mrh.ms_reg_history_id,
															regcode,
															mrh.year,
															mrh.first_name,
												          	mrh.last_name,
															mrh.chyk_ref_first_name,
												          	mrh.chyk_ref_last_name,
															mrh.email,
															mrh.phone,
															mrh.address,
															mrh.address1,
															mrh.city,
															mrh.state,
															mrh.country,
															mrh.zip,
															mrh.is_teacher,
															mrh.sn_wheelchair,
															mrh.sn_room,
															mrh.sn_requests,
															mrh.numadultreg,
															mrh.numchildreg,
															mrh.numchykreg,
															mrh.numbiksha,
															mrh.numarathi,
															mrh.reg_type,
															mrh.need_accommodation,
															mrh.reg_type_desc,
															mrh.reg_case,
															mrh.reg_case_desc,
															mrh.reg_fee,
															mrh.sponsor_amount,
															mrh.donation_amount,
															mrh.discount_amount,
															mrh.payment_type,
															mrh.payment_transaction_id,
															mrh.payment_response,
															mrh.payment_status,
															mrh.check_num,
															mrh.amount_committed,
															mrh.amount_paid,
															mrh.comments,
															mrh.enabled,
															mrh.date_created,
															mrh.date_modified
												FROM      	ms_reg_history mrh
												WHERE       mrh.ms_reg_history_id = ' . $this->db->escape( $ms_reg_history_id ) . '
											  ');

			if($getRegistrant->num_rows() == 1)
			{											  
				$ms_registration_value->setMSRegHistoryID( $getRegistrant->row()->ms_reg_history_id );
				$ms_registration_value->setRegCode($getRegistrant->row()->regcode);
				$ms_registration_value->setCurrentYear( $getRegistrant->row()->year );
				$ms_registration_value->setFirstName( $getRegistrant->row()->first_name );
				$ms_registration_value->setLastName( $getRegistrant->row()->last_name );
				$ms_registration_value->setCHYKRefFirstName( $getRegistrant->row()->chyk_ref_first_name );
				$ms_registration_value->setCHYKRefLastName( $getRegistrant->row()->chyk_ref_last_name );
				$ms_registration_value->setEmail( $getRegistrant->row()->email );
				$ms_registration_value->setPhone( $getRegistrant->row()->phone );
				$ms_registration_value->setAddress( $getRegistrant->row()->address );
				$ms_registration_value->setAddress1( $getRegistrant->row()->address1 );
				$ms_registration_value->setCity( $getRegistrant->row()->city );
				$ms_registration_value->setState( $getRegistrant->row()->state );
				$ms_registration_value->setCountry( $getRegistrant->row()->country );
				$ms_registration_value->setZip( $getRegistrant->row()->zip );
				$ms_registration_value->setIsTeacher($getRegistrant->row()->is_teacher);
				$ms_registration_value->setSpecialNeedsWheelchair( $getRegistrant->row()->sn_wheelchair );
				$ms_registration_value->setSpecialNeedsRoom( $getRegistrant->row()->sn_room );
				$ms_registration_value->setSpecialRequests( $getRegistrant->row()->sn_requests );
				$ms_registration_value->setNumAdultRegistered( $getRegistrant->row()->numadultreg );
				$ms_registration_value->setNumChildRegistered( $getRegistrant->row()->numchildreg );
				$ms_registration_value->setNumCHYKRegistered( $getRegistrant->row()->numchykreg );
				$ms_registration_value->setNumBiksha( $getRegistrant->row()->numbiksha );
				$ms_registration_value->setNumArathi( $getRegistrant->row()->numarathi );
				$ms_registration_value->setRegistrationType( $getRegistrant->row()->reg_type );
				$ms_registration_value->setNeedAccommodation( $getRegistrant->row()->need_accommodation );
				$ms_registration_value->setRegistrationTypeDescription( $getRegistrant->row()->reg_type_desc );
				$ms_registration_value->setRegistrationCase( $getRegistrant->row()->reg_case );
				$ms_registration_value->setRegistrationCaseDescription( $getRegistrant->row()->reg_case_desc );
				$ms_registration_value->setRegistrationFee( $getRegistrant->row()->reg_fee );
				$ms_registration_value->setSponsorship( $getRegistrant->row()->sponsor_amount );
				$ms_registration_value->setDonation( $getRegistrant->row()->donation_amount );
				$ms_registration_value->setGeneralDiscount( $getRegistrant->row()->discount_amount );
				$ms_registration_value->setPaymentType( $getRegistrant->row()->payment_type );
				$ms_registration_value->setPaymentTransactionID( $getRegistrant->row()->payment_transaction_id );
				$ms_registration_value->setPaymentResponse( $getRegistrant->row()->payment_response );
				$ms_registration_value->setPaymentStatus( $getRegistrant->row()->payment_status );
				$ms_registration_value->setCheckNum( $getRegistrant->row()->check_num );
				$ms_registration_value->setAmountCommitted( $getRegistrant->row()->amount_committed );
				$ms_registration_value->setAmountPaid( $getRegistrant->row()->amount_paid );
				$ms_registration_value->setComments( $getRegistrant->row()->comments );
				$ms_registration_value->setEnabled( $getRegistrant->row()->enabled );
				$ms_registration_value->setDateCreated( $getRegistrant->row()->date_created );
				$ms_registration_value->setDateModified( $getRegistrant->row()->date_modified );
			}
			
			return $ms_registration_value; 
		} //getMahasamadhiRegistrationObject( $ms_reg_history_id )
		
	}
?>